<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:drawingui="clr-namespace:OpenLS.Drawing.UI"
    xmlns:Internals="clr-namespace:OpenLS.Drawing.UI.Internals"
    xmlns:drawing="http://schemas.Kherty.com/office/2007/drawing"
    xmlns:Internals1="clr-namespace:OpenLS.UI.Internals;assembly=OpenLS.UI"
    xmlns:UI="clr-namespace:OpenLS.UI;assembly=OpenLS.UI" xmlns:Internals2="clr-namespace:OpenLS.Chart.UI.Internals" x:Class="OpenLS.Drawing.UI.LineResources"
        >
    <ResourceDictionary.MergedDictionaries>
        <drawingui:ColorResources/>
        <drawingui:EnumResources/>
    </ResourceDictionary.MergedDictionaries>
    <CollectionViewSource x:Key ="fillColors"
  Source="{Binding Source={x:Static drawingui:ColorManager.UIColors}}">
        <CollectionViewSource.GroupDescriptions>
            <drawingui:ColorGrouping/>
        </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>
    <DataTemplate DataType="{x:Type Internals:ShapeLineFillFormatter}">
        <StackPanel  >
            <StackPanel.Resources>
                <CollectionViewSource Source="{Binding Colors}" x:Key="colors">
                    <CollectionViewSource.GroupDescriptions>
                        <drawingui:ColorGrouping/>
                    </CollectionViewSource.GroupDescriptions>
                </CollectionViewSource>

            </StackPanel.Resources>
            <RadioButton Content="{x:Static Internals:UIStringTable.NoFill}" Name="noFill" IsChecked="{Binding IsNone, Mode=OneTime}" Command="{Binding SetNoFillCommand}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.SolidFill}" Name="solidFill" IsChecked="{Binding IsSolid, Mode=OneTime}" Command="{Binding SetSolidFillCommand}"
                         CommandParameter="{Binding ElementName=colors, Path=SelectedItem}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.GradientFill}" Name="gradientFill" IsChecked="{Binding IsGradient, Mode=OneTime}" Command="{Binding SetGradientFillCommand}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.PictureOrTextureFill}" Name="pictureFill"  IsChecked="{Binding IsPictureOrTexctureFill, Mode=OneTime}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.Automatic}" Name="automatic" IsChecked="{Binding IsAutomatic, Mode=OneTime}" Command="{Binding SetAutomaticFillCommand}"/>
            <StackPanel Orientation ="Horizontal" Name="solidFillPanel" Visibility="Collapsed">
                <TextBlock Text="{x:Static Internals1:UIStringTable.Color}"/>
                <ComboBox SelectedIndex ="-1"  Name="colors"
                  Tag="{Binding Source={StaticResource colors}}" 
                          Style="{StaticResource {x:Static drawingui:DrawingKeys.ColorComboBoxStyleKey}}">
                </ComboBox>
            </StackPanel>
            <ContentControl Content="{Binding ShapeProperties.FillProperties}" Visibility="Collapsed" Name="gradientContentControl"></ContentControl>
        </StackPanel>

        <DataTemplate.Triggers>
            <Trigger SourceName="solidFill" Property="IsChecked" Value="True">
                <Setter TargetName="colors" Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></Setter>
                <Setter TargetName="colors" Property="SelectedItem" Value="{Binding SeletedColor}"></Setter>
            </Trigger>
            <Trigger SourceName="gradientFill" Property="IsChecked" Value="True">
                <Setter TargetName="gradientContentControl" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger SourceName="solidFill" Property="IsChecked" Value="True">
                <Setter TargetName="solidFillPanel" Property="Visibility" Value="Visible"/>
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type Internals:LineStyleFormatter}">
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="80"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Label Content="{x:Static Internals:UIStringTable.Width_}"/>
            <!--TOCHANGE            <drawingui:UpDownControl  Grid.Column="1" Format="{}{0:##0.##}pt"  Maximum="199" SmallChange="0.25"  ValueChanged="Width_ValueChanged" Loaded="Width_Loaded"/> -->
            <UI:NumericUpDown Name="updown" Format="{}{0:##0.##}pt"  Grid.Column="1"   Maximum="199" SmallChange="0.25" Value="{Binding Width}" />
            <Label Grid.Row="1" Content="{x:Static Internals:UIStringTable.DashType_}"/>
            <ComboBox Grid.Column="1" Grid.Row="1"
                      ItemsSource="{Binding Source={x:Type drawing:PresetLineDashValue}, Converter={x:Static Internals:DrawingConverters.EnumEnumerator}}" 
                      SelectedItem="{Binding DashArray}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Line StrokeThickness="3" Stroke="Black" X2="80" Margin="10">
                            <Line.StrokeDashArray>
                                <Binding Converter="{x:Static Internals:DrawingConverters.PresetLineDashValueToStrokeDashArrayConverter}">
                                </Binding>
                            </Line.StrokeDashArray>
                        </Line>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <Label Grid.Row="2" Content="{x:Static Internals:UIStringTable.CapType_}"/>
            <ComboBox  Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Source={x:Type drawing:LineCap}, Converter={x:Static Internals:DrawingConverters.EnumEnumerator}}" 
                SelectedItem="{Binding LineCap}" />
            <!--            <ComboBox ItemsSource="{Binding Source={x:Type drawing:Line}, Converter={x:Static drawingui:DrawingConverters.EnumEnumerator}}" /> -->
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="LineStyleControlTemplateKey"> 
        <Grid Loaded="Grid_Loaded">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="80"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Label Content="{x:Static Internals:UIStringTable.Width_}"/>
<!--TOCHANGE            <drawingui:UpDownControl  Grid.Column="1" Format="{}{0:##0.##}pt"  Maximum="199" SmallChange="0.25"  ValueChanged="Width_ValueChanged" Loaded="Width_Loaded"/> -->
            <UI:NumericUpDown Name="updown" Format="{}{0:##0.##}pt"  Grid.Column="1"   Maximum="199" SmallChange="0.25"  />
            <Label Grid.Row="1" Content="{x:Static Internals:UIStringTable.DashType_}"/>
            <ComboBox Grid.Column="1" Grid.Row="1"
                      ItemsSource="{Binding Source={x:Type drawing:PresetLineDashValue}, Converter={x:Static Internals:DrawingConverters.EnumEnumerator}}" 
                      SelectionChanged="DashArray_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Line StrokeThickness="3" Stroke="Black" X2="80" Margin="10">
                            <Line.StrokeDashArray>
                                <Binding Converter="{x:Static Internals:DrawingConverters.PresetLineDashValueToStrokeDashArrayConverter}">
                                </Binding>
                            </Line.StrokeDashArray>
                        </Line>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <Label Grid.Row="2" Content="{x:Static Internals:UIStringTable.CapType_}"/>
            <ComboBox  Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Source={x:Type drawing:LineCap}, Converter={x:Static Internals:DrawingConverters.EnumEnumerator}}" 
                      SelectionChanged="LineCap_SelectionChanged"/>
<!--            <ComboBox ItemsSource="{Binding Source={x:Type drawing:Line}, Converter={x:Static drawingui:DrawingConverters.EnumEnumerator}}" /> -->
        </Grid>
    </DataTemplate>
</ResourceDictionary>